#ifndef DISPLAYER_H
#define DISPLAYER_H

#include <QObject>
#include <QVector>
#include <QWidget>
#include <QScreen>
#include <QApplication>

#include "myconfig.h"
#include "videowindow.h"
#include "toast.h"

class Displayer : public QWidget
{
    Q_OBJECT
public:
    explicit Displayer(int videoMode, QWidget *parent = nullptr);
    ~Displayer();

    QVector<VideoWindow*> m_videoWindows; //创建四个显示器，每个显示器四个窗口
    QVector<WINDOW_CONFIG> m_windowConfig =
    {WINDOW_CONFIG{},WINDOW_CONFIG{}, WINDOW_CONFIG{}, WINDOW_CONFIG{}};  //配置

    QGridLayout* m_gridLayout;
    int m_currentLayout;
    LoadQss m_loadQss;  //加载qss类

    bool startReceiving();  //开始采集流
    void initUI();
    void resetSettings(int videoID);


public slots:
    void onChangeViewMode(int mode);

protected:
    void contextMenuEvent(QContextMenuEvent *event) override;  // 重写右键菜单事件

signals:
    void sigExit();          //退出整个程序
    void sigOpenSettings();  //打开设置界面
    void sigChangedVideoMode(int index);
    void sigSendDataToSave(int videoID, const QByteArray &data, QString ipSrc, quint16 portSrc);  //转发后存储
    void sigSrcs(int videoID, QString src);
    void sigVideoInfoChanged(int videoID, int width, int height, int fps);
};

#endif // DISPLAYER_H
